<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!--	<bean id="dataSource"-->
<!--		class="com.mchange.v2.c3p0.ComboPooledDataSource"-->
<!--		destroy-method="close">-->
<!--		<property name="driverClass" value="com.mysql.jdbc.Driver" />-->
<!--		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/hibernatefahrtenbuch" />-->
<!--		<property name="user" value="root" />-->
<!--		<property name="password" value="" />-->
<!--		<property name="minPoolSize" value="2" />-->
<!--      	<property name="maxPoolSize" value="4" />-->
<!--	</bean>-->
	
	<bean id="hibernateSessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
<!--		<property name="configLocation" value="classpath:hibernate.cfg.xml"/>-->
		<property name="annotatedClasses">
			<list>
				<value>om.Boot</value>
				<value>om.Fahrt</value>
				<value>om.Person</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
			</props>
		</property>
	</bean>
	
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<!-- ******************* -->
	<!-- Data Access Objekte -->
	<!-- ******************* -->
	
	<bean id="bootDao" class="dao.BootDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

	<bean id="personDao" class="dao.PersonDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<bean id="fahrtDao" class="dao.FahrtDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

	<!-- ************** -->
	<!-- Die Controller -->
	<!-- ************** -->
	
	<bean name="HomeCo" class="controller.Home" />
	
	<bean name="LogoutCo" class="controller.Logout" />
	
	<bean name="AlleBooteCo" class="controller.AlleBoote">
		<property name="bootDao" ref="bootDao"/>
	</bean>
	
	<bean name="EditBootCo" class="controller.EditBoot">
		<property name="bootDao" ref="bootDao"/>
	</bean>

	<bean name="LoescheBootCo" class="controller.LoescheBoot">
		<property name="bootDao" ref="bootDao"/>
	</bean>	
	
	<bean name="NeuesBootCo" class="controller.EditBoot">
		<property name="bootDao" ref="bootDao"/>
	</bean>
	
	<bean name="SaveBootCo" class="controller.SaveBoot">
		<property name="bootDao" ref="bootDao"/>
	</bean>
	
	<bean name="AllePersonenCo" class="controller.AllePersonen">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="EditPersonCo" class="controller.EditPerson">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="NeuePersonCo" class="controller.EditPerson">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="SavePersonCo" class="controller.SavePerson">
		<description>controller.SavePerson is a subclass of controller.AllePersonen.
			This allows us to redirect to controller.AllePersonen after saving.
			The property personDao has to be set anyway.</description>
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="LoeschePersonCo" class="controller.LoeschePerson">
		<description>controller.LoeschePerson is a subclass of controller.AllePersonen.
			This allows us to redirect to controller.AllePersonen after deleting.
			The property personDao has to be set anyway.</description>
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="FreieBooteCo" class="controller.FreieBoote">
		<property name="bootDao" ref="bootDao"/>
	</bean>
	
	<bean name="AlleFahrtenCo" class="controller.AlleFahrten">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="false"/>
	</bean>

	<bean name="BeginneFahrtCo" class="controller.BeginneFahrt">
		<property name="bootDao" ref="bootDao"/>
		<property name="personDao" ref="personDao"/>
	</bean>

	<bean name="AktuelleFahrtenCo" class="controller.AlleFahrten">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="true"/>
	</bean>
	
	<bean name="BeendeFahrtCo" class="controller.AlleFahrten">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="true"/>
	</bean>
	
	<bean name="SaveFahrtCo" class="controller.SaveFahrt">
		<property name="fahrtDao" ref="fahrtDao"/>
	</bean>
	
	<bean name="StopFahrtCo" class="controller.StopFahrt">
		<property name="fahrtDao" ref="fahrtDao"/>
	</bean>
	
	<bean name="AlleFahrtenVollCo" class="controller.AlleFahrtenVoll">
		<property name="fahrtDao" ref="fahrtDao"/>
	</bean>
	
</beans>
